# tests/test_merge_filled_indicators.py
import pandas as pd
from merge_filled_indicators import merge_filled_data

def test_merge_filled_data():
    main_df = pd.DataFrame({
        '序号': [1, 2],
        '国名Ch': ['中国', '美国'],
        'Year': [2020, 2020],
        'GDP': [14.7, None],
        '人口': [1400, 328]
    })
    
    filled_df = pd.DataFrame({
        '序号': [2],
        '国名Ch': ['美国'],
        'Year': [2020],
        'GDP': [21.4],
        '人口': [328]
    })
    
    result = merge_filled_data(main_df, filled_df, ['序号', '国名Ch', 'Year'])
    
    assert result['GDP'].isna().sum() == 0
    assert result.loc[1, 'GDP'] == 21.4
    assert result.loc[0, 'GDP'] == 14.7